#@layout()

#define js()
    <script>
    $(function(){
        var _table;
        _table =$("#dictionary-list").DataTable( {
            aLengthMenu:[10,20,50],
            "processing": true,
            "serverSide": true,
            "bLengthChange": false,
            "bSort":false,
            "bStateSave":true,
            searching: false,//屏蔽datatales的查询框
            "pagingType":   "full_numbers",
            "ajax":{
                "url": "/admin/dictionary/listAll",
                "type": "post",
                "data": function (params) {
                        params["dictionary.name"]=$("#name").val();
                }
            },
            "columns": [
                    { "data": "id" },
                    { "data": "name" },
                    { "data": "remark" },
                    { "data": "pid" },
                    { "data": "code" },
                { "data": function(data){
                    var edit="<a href='javascript:;' onclick='edit("+data.id+")'>编辑</a>"+"|";
                    var del="<a href='javascript:;' onclick='del("+data.id+")'>删除</a>";
                    return edit+del;
                }
                }
            ]
        } );
        $("#searchBtn").click(function(){
            _table.ajax.reload();
        });
});
    /*编辑*/
    function edit(id){
        var title="编辑";
        var url="#(contextPath)/admin/dictionary/queryById?id="+id;
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }
    /*添加*/
    function add(){
        var title="添加";
        var url="#(contextPath)/admin/dictionary/add/";
        var w="";
        var h=510;
        layer_show(title,url,w,h);
    }

    /*删除*/
    function del(id){
        var config = {
        "url":"#(contextPath)/admin/dictionary/deleteById?id="+id,
        data:{}
        };
        var backendTool = new BackendTool(config);
        backendTool.ajaxRequest();
    }
    </script>
#end

#define main()
    #@breadcrumb(["数据字典管理","数据字典列表"])
   <div class="page-container">
       <div class="text-c">
           <input type="text" name="" id="name" placeholder="请输入数据字典名称...." style="width:350px" class="input-text">
           <button name="" id="searchBtn" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>检索</button>
       </div>
       <div class="cl pd-5 bg-1 bk-gray mt-20">
    <span class="l">
        <a href="javascript:;" onclick="add()" class="btn btn-primary radius">添加</a>
    </span>
           <span class="r"></div>
       <div class="mt-20">
           <table class="table table-border table-bordered table-bg table-hover table-sort" id="dictionary-list">
               <thead>
               <tr class="text-c">
                     <th></th>
                     <th>数据字典名称</th>
                     <th>数据字典备注信息</th>
                     <th>父节点ID</th>
                     <th>数字字典的code值</th>
                   <th>操作</th>
               </tr>
               </thead>
               <tbody>
               </tbody>
           </table>
       </div>
   </div>
#end